package com.wgke.bluetooth.db;


import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;

import java.util.List;

@Dao
public interface TypeDao {
    // 插入单个TypeEntity
    @Insert
    void insert(TypeEntity typeEntity);

    // 插入多个TypeEntity
    @Insert
    void insertAll(List<TypeEntity> typeEntities);

    // 根据projectId查询对应的TypeEntity列表
    @Query("SELECT * FROM typeEntity WHERE projectId = :projectId")
    List<TypeEntity> getTypeEntitiesByProjectId(int projectId);

    // 查询所有TypeEntity
    @Query("SELECT * FROM typeEntity")
    List<TypeEntity> getAllTypeEntities();

    // 删除所有TypeEntity
    @Query("DELETE FROM typeEntity")
    void deleteAll();

    // 根据projectId删除所有对应的TypeEntity
    @Query("DELETE FROM typeEntity WHERE projectId = :projectId")
    void deleteByProjectId(int projectId);
}
